<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>有奖答题平台</title>
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
    <link rel="stylesheet" href="/lib/mobile/css/common.css?000"/>
    <link rel="stylesheet" href="/lib/mobile/css/property.css"/>
    <!--<link rel="stylesheet" href="/lib/mobile/css/review.css"/>-->
</head>
<body>

<div class="property_header">
    <div class="property_year"><span>2021年</span><i></i></div>
    <div class="property_head">
        <img src="/lib/mobile/img/uhead.png" alt="" />
        <span id="xm"></span>
    </div>
    <div class="property_money">
        <strong id="property_money"></strong><span>智慧币</span>
    </div>
    <div class="property_caption">智慧币总额</div>
</div>
<div class="main">
    <ul class="bui-list">
        <div id="ywclist" class="bui-scroll property_list">
            <!--<div class="bui-scroll-head"></div>-->
            <div class="bui-scroll-main">
                <ul class="bui-list bui-list-thumbnail" id="ddlb">

                </ul>
            </div>
            <!--<div class="bui-scroll-foot"></div>-->
        </div>
    </ul>
    <ul class="bottom_menu">
        <li  id="indexsy"><a href="javascript:void(0);">首页</a></li>
        <!--<li>|</li>-->
        <li  id="hdrule"><a href="javascript:void(0);">活动规则</a></li>
        <!--<li  id="point_rule"><a href="javascript:void(0);">积分规则</a></li>-->
        <!--<li>|</li>-->
        <!--<li id="prize_rule"><a href="javascript:void(0);">抽奖规则</a></li>-->
        <!--<li>|</li>-->
        <li id="center"><a href="javascript:void(0);">个人中心</a></li>
    </ul>
</div>
<!-- 依赖库 手机调试的js引用顺序如下 -->
<script src="/lib/mobile/js/zepto.js"></script>
<script src="/lib/mobile/js/plugins/fastclick.js"></script>
<script src="/lib/mobile/js/bui.js"></script>
<script src="/lib/mobile/js/common.js?1111    "></script>
<script>
    bui.ready(function () {
        // 这里写业务及控件初始化
        var storage = bui.storage();
        var yhbm=storage.get("yhbm");
        var uid=storage.get("uid");
        $("#xm").html(yhbm[0]);
        bui.btn({id: ".bui-page", handle: ".bui-btn"}).load();
        var pageview = {};
        pageview.init = function () {
            $("#indexsy").on("click", function (argument) {
                bui.load({ url: BASE_URL+"mobile/index"});
            });
            $("#point_rule").on("click", function (argument) {
                bui.load({ url: BASE_URL+"mobile/point_rule"});
            });
            $("#prize_rule").on("click", function (argument) {
                bui.load({ url: BASE_URL+"mobile/prize_rule"});
            });
            $("#center").on("click", function (argument) {
                bui.load({ url: BASE_URL+"mobile/center"});
            });
            var loginAjax = bui.ajax({
                url: BASE_URL+"mobile/getTotalAward",
                // 可选参数
                data: {
                    uid:uid[0]
                },
                method: "POST"
            });
            loginAjax.then(function(res) {
                var data = res.data;
                // console.log(data)
                $("#property_money").html(data.totalmoney);
            },function(res) {
                bui.alert("请求异常");
            })
            //我的积分
            getDayAwardList(uid[0]);
        }
        pageview.init();
    })

    function getDayAwardList(uid){
        bui.list({
            id: "#ywclist",
            url: BASE_URL+"mobile/getDayAwardList",
            pageSize: 10,
            data: {uid:uid},
            field: {
                page: "page",
                size: "pageSize",
                data: "data"
            },
            callback: function(e) {
                // e.target 为你当前点击的元素
                // e.currentTarget 为你当前点击的handle 整行
            },
            template: function(data) {
                var html = "";
                // console.log(data)
                // $("#property_money").html(res.count);
                for(var i=0;i<data.length;i++){
                    var award=data[i].award;
                    var awardtime=data[i].awardtime;
                        html +="<li>\n" +
                            "            <h3><span>每日答题抽奖</span><b>"+award+"智慧币</b></h3>\n" +
                            "            <h4>"+awardtime+"</h4>\n" +
                            "        </li>";
                }
                return html;
            },
            onBeforeRefresh: function() {
                // console.log("brefore refresh")
            },
            onBeforeLoad: function() {
                // console.log("brefore load")
            },
            onRefresh: function() {
                // 刷新以后执行
                // console.log("refreshed")
            },
            onLoad: function() {
                // 刷新以后执行
                // console.log("loaded")
            }
        })
    }
</script>
</body>
</html>